package com.centerm.common.constant.enums.operation;

import com.centerm.common.constant.StatusCode;

/**
* @Description
* @author Fly
* @date 2017年8月9日
 */
public enum OperationType implements StatusCode {
	MILESTONE_CREATE(21, "创建里程碑信息"),
	MILESTONE_UPDATE(22, "更新里程碑信息"),
	MILESTONE_DELETE(23, "删除里程碑信息"),
	
	PROJECT_BASEINFO_CREATE(31, "创建项目基础信息"),
	PROJECT_BASEINFO_UPDATE(32, "修改项目基础信息"),
	PROJECT_MILESTONE_CREATE(33, "创建项目里程碑"),
	PROJECT_CYCLEACTIVITY_CREATE(34, "创建项目全局活动"),
	PROJECT_MILESTONE_SUBMIT(35, "完成提交里程碑"),
	PROJECT_MILESTONE_DELETE(36, "删除项目里程碑"),
	
	TASK_CREATE(50, "创建任务"),
	TASK_UPDATE(51, "更改基本信息"),
	TASK_UPDATE_STATUS(52, "更改状态"),
	TASK_REPLY(53, "添加回复"),
	;
	
	private Integer code;
	private String description;
	
	
	OperationType(Integer code, String description) {
		this.code = code;
		this.description = description;
	}
	

	@Override
	public Integer getCode() {
		return this.code;
	}


	@Override
	public String getDescription() {
		return this.description;
	}
	public static StatusCode getByCode(Integer code) {
		for(OperationType operationType : OperationType.values()) {
            if(operationType.getCode().equals(code)) {
                return operationType;
            }
        }
        return null;
	}


	public static String getDescriptionByCode(Integer code) {
		for(OperationType operationType : OperationType.values()) {
            if(operationType.getCode().equals(code)) {
                return operationType.getDescription();
            }
        }
        return null;
	}
}
